package com.kou.spring.config;


import com.kou.spring.bean.Person;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;


/**
 * 这是一个配置类
 *
 * @author Kou
 */
@Configuration
@Import(Person.class)
public class MainConfig {

//	@Bean
//	public Person person() {
//		Person person = new Person();
//		person.setName("李四");
//		return person;
//	}

	/**
	 * BeanDefinitionRegistry:Bean定义信息注册中心
	 */
	class MyImportRegister implements ImportBeanDefinitionRegistrar{
		@Override
		public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
			//Spring定义需要Bean的类型、名字
			ImportBeanDefinitionRegistrar.super.registerBeanDefinitions(importingClassMetadata, registry);
		}
	}
}


